<template>
	<view class="page">
		<view class="result">
			<image src="https://i.ringzle.com/file/20240221/afe4259bb3484ca1889cb96341f05a10.png"></image>
			<text>{{!changeTicket?'支付成功':'改签成功'}}</text>
			<!-- <view v-if="!changeTicket">￥<span>{{price}}</span></view> -->
		</view>
		<view class="hn_tip" v-if="isHn">
			花鸟岛入岛需购买门票，船票购买成功后建议您提前购买入岛门票
		</view>
		<view class="btns" :style="{'margin-top':(isHn?142:268)+'rpx'}">
			<view @tap="toDetails">查看订单</view>
			<view @tap="toReturnHome">关闭</view>
		</view>
		<image v-if="isHn" class="hn_img" src="https://i.ringzle.com/file/20231218/97e2aa4c54de412cb09e3f59913fbb34.png"
			@tap="toFlowerBrid"></image>
	</view>
</template>

<script>
	export default {
		name: 'payResult',
		data() {
			return {
				h: uni.getSystemInfoSync().windowHeight,
				mt: uni.getSystemInfoSync().statusBarHeight + 44,
				price: '',
				orderId: '',
				type: '',
				changeTicket: false,
				isHn: false ,//目的地是否是花鸟岛,
				isCxghDc:false//是否是出行规划多程
			}
		},
		methods: {
			init(item){
				if (item.price) this.price = item.price;
				if (item.orderId) this.orderId = item.orderId;
				if (item.type) this.type = item.type;
				if (item.gqType) {
					this.changeTicket = true;
					uni.setNavigationBarTitle({
						title: '改签结果'
					})
				}
				if(item.isCxghDc) this.isCxghDc = true;
				if (item.endPortName) {
					if (item.endPortName.indexOf('花鸟') > -1) this.isHn = true;
				}
			},
			toDetails() {
				let url = '/pagesMy/shipTicketOrder/details?orderId=' + this.orderId;
				if (this.type == 'goback' || this.isCxghDc) url = '/pagesMy/order/index';
				uni.redirectTo({
					url
				})
			},
			toReturnHome() {
				this.$emit('toCloseShip');
			},
			toFlowerBrid() {
				uni.navigateTo({
					url: '/pagesTrip/scenicSpots/index'
				})
			}
		}
	}
</script>

<style scoped lang="less">
	.page {
		padding: 0 40rpx 40rpx;
		position: relative;

		.result {
			display: flex;
			flex-direction: column;
			align-items: center;
			margin-top: 64rpx;

			image {
				width: 96rpx;
				height: 96rpx;
			}

			&>text {
				font-size: 32rpx;
				font-family: PingFang-SC-Bold, PingFang-SC;
				font-weight: bold;
				color: #111111;
				margin-top: 20rpx;
			}

			&>view {
				font-size: 36rpx;
				font-family: ArialMT;
				color: #333333;
				margin-top: 20rpx;

				span {
					font-size: 48rpx;
					font-family: Arial-BoldMT, Arial;
					font-weight: normal;
					color: #333333;
				}
			}
		}

		.hn_tip {
			width: 100%;
			padding: 0 58rpx;
			box-sizing: border-box;
			text-align: center;
			font-size: 30rpx;
			font-family: PingFangSC, PingFang SC;
			font-weight: 400;
			color: #666666;
			line-height: 48rpx;
			margin-top: 30rpx;
		}

		.btns {
			display: flex;
			align-items: center;
			justify-content: space-between;
			margin-top: 268rpx;

			&>view {
				width: calc(50% - 22rpx);
				height: 88rpx;
				border-radius: 46rpx;
				border: 2rpx solid #CCCCCC;
				line-height: 88rpx;
				text-align: center;
				font-size: 32rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #333333;

				&:last-child {
					border: 2rpx solid #007A69;
					color: #007A69;
				}
			}
		}

		.hn_img {
			width: 100%;
			height: 248rpx;
			margin-top: 177rpx;
		}
	}
</style>